<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/common/global.jsp"%>
<html>
<head>
	<meta charset="utf-8" />
	<title><spring:message code="sw.sys.name"/></title>
	<meta name="description" content="<spring:message code="sw.sys.name"/>" />
	<meta name="keywords" content="<spring:message code="sw.sys.name"/>"/>
	<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
	<link rel="stylesheet" href="${ctxPath}/static/css/amazeui.min.css" />
	<link rel="stylesheet" href="${ctxPath}/static/css/style.css" />
</head>
<body>
<%--<header data-am-widget="header" class="am-header am-header-default header">
	&lt;%&ndash;<div class="am-header-left am-header-nav">
		<a href="${ctxPath}/sysUser/do_member_Page" class="">
			<i class="am-header-icon am-icon-angle-left"></i>
		</a>
	</div>`&ndash;%&gt;
	&lt;%&ndash;<h1 class="am-header-title"> <a href="javascript:void(0)" class="" style="color: #333;">全部订单</a></h1>&ndash;%&gt;
	<div class="am-header-right am-header-nav">
		<a href="#right-link" class=""> </a>
	</div>
</header>--%>
<%--<div class="cate-search" style="position: relative; top: 0; border-bottom: 0;">--%>
	<%--&lt;%&ndash;<input type="text" class="cate-input" placeholder="输入订单号查询">&ndash;%&gt;--%>
	<%--<input type="button" class="cate-btn">--%>
<%--</div>--%>
	    <ul class="order-style">
	    	<li <c:if test="${ queryType eq 'a181a603769c1f98ad927e7367c7aa51' || empty queryType }">class="current"</c:if>><a href="${ctxPath}/busiOrder/dataGrid?phoneNo=${phoneNo}&validateCode=${validateCode}">全部</a></li>
	    	<li <c:if test="${ queryType eq '14855e29c2d489f11b719a82a1e8fdeb'}">class="current"</c:if>><a href="${ctxPath}/busiOrder/dataGrid?queryType=14855e29c2d489f11b719a82a1e8fdeb&phoneNo=${phoneNo}&validateCode=${validateCode}">待付款</a></li>
	    	<li <c:if test="${ queryType eq 'a729230892f76445e49ed2058d03538e'}">class="current"</c:if>><a href="${ctxPath}/busiOrder/dataGrid?queryType=a729230892f76445e49ed2058d03538e&phoneNo=${phoneNo}&validateCode=${validateCode}">待收货</a></li>
	    	<li <c:if test="${ queryType eq '089f31b990aa530c5863dbc9ff606016'}">class="current"</c:if>><a href="${ctxPath}/busiOrder/dataGrid?queryType=089f31b990aa530c5863dbc9ff606016&phoneNo=${phoneNo}&validateCode=${validateCode}">待评价</a></li>
	    	<%--<li <c:if test="${ queryType eq '--'}">class="current"</c:if>><a href="">退换货</a></li>--%>
	    </ul>
		<c:choose>
			<c:when test="${!empty pageInfo}">
				<c:forEach items="${pageInfo.records}" var="order">
					<c:if test="${!empty order}">
					<div class="c-comment">
						<span class="c-comment-num">订单编号：${order.orderNo}</span>
						<span class="c-comment-suc"><c:if test="${order.payStatus eq '10'}">待付款</c:if><c:if test="${order.payStatus eq '20'}">已支付</c:if></span>
					</div>
					<div class="c-comment-list" style="border: 0;">
						<c:forEach items="${order.busiOrderItemList}" var="orderItem">
						<a class="o-con" href="" style="height:20%;">
							<div class="o-con-img"><img src="${staticServer}${orderItem.standy1}"></div>
							<div class="o-con-txt">
								<p>${orderItem.prodName}</p>
								<p class="price">￥<fmt:formatNumber value="${orderItem.prodPrice}" type="currency" pattern="#.##"/></p>
								<p>合计：<span>￥<fmt:formatNumber value="${orderItem.totalPrice}" type="currency" pattern="#.##"/></span></p>
							</div>
							<div class="o-con-much"> <h4>x${orderItem.sum}</h4></div>
						</a>
						</c:forEach>
						<div class="c-com-money">共${fn:length(order.busiOrderItemList)}个商品 实付金额：<span>￥<fmt:formatNumber value="${order.standy1}" type="currency" pattern="#.##"/>(原价:<fmt:formatNumber value="${order.totalAmount}" type="currency" pattern="#.##"/>)</span></div>

					</div>
					<div class="c-com-btn">
						<c:if test="${order.payStatus eq '10'}"><a href="${ctxPath}/busiOrder/toPay?orderId=${order.id}">立即支付</a></c:if>
						<c:if test="${order.payStatus eq '10'}"><a href="javascript:void(0)" onclick="cancelOrder('${order.id}')">取消订单</a></c:if>
					</div>
					</c:if>
				</c:forEach>
			</c:when>

			<c:otherwise>
				暂无订单！
			</c:otherwise>
		</c:choose>
<%--
		<div class="clear"></div>
		<div class="c-comment">
			<span class="c-comment-num">订单编号：150916517682</span>
			<span class="c-comment-suc">卖家已发货</span>
		</div>
		<div class="c-comment-list" style="border: 0;height:100px;">
			<a class="o-con" href="">
				<div class="o-con-img"><img src="${ctxPath}/static/images/detail.png"></div>
				<div class="o-con-txt">
					<p>我是静态数据Y^_^Y</p>
					<p class="price">￥88</p>
					<p>合计：<span>￥176.00</span></p>
				</div>
				<div class="o-con-much"> <h4>x2</h4></div>

			</a>
			<div class="c-com-money">花5个商品 实付金额：<span>￥ 175.00</span></div>
		</div>
		<div class="c-com-btn">
			<a href="">确认收货</a>
		</div>
		<div class="clear"></div>--%>
	</body>
	<%@include file="/common/footer.jsp"%>
<script>
    function cancelOrder(id) {
        layer.confirm('确定要取消订单吗？',{btn:['确定','再想想']},
		function(){
            // alert("你点了确定!");
            $.ajax({
                url:"${ctxPath}/busiOrder/delete",
                type:"POST",
                data:{"id":id},
                dataType:"JSON",
                success:function(data){
                    logger.info(JSON.stringify(data));
                    if (data.success == true) {
                        layer.msg('取消订单成功！'
                            ,{
                                icon: 1,
                                time: 20000, //20s后自动关闭
                                btn: ['确定']
                            }
                            , function(){
                                // 刷新当前页面.
								window.location.reload();
                            });

                    } else {
                        layer.msg('取消订单失败！', {icon: 1});
                    }
                },
                error:function(data){
                    logger.error(JSON.stringify(data));
                }
            });
		},
		function(){
            // alert("你点了取消!");
			// do nothing ...
		});

    }


</script>
</html>
